package com.nbsaas.boot.marketing.rest.resource;

import com.nbsaas.boot.marketing.api.apis.PointsRuleApi;
import com.nbsaas.boot.marketing.data.entity.PointsRule;
import com.nbsaas.boot.marketing.api.domain.request.PointsRuleRequest;
import com.nbsaas.boot.marketing.api.domain.response.PointsRuleResponse;
import com.nbsaas.boot.marketing.api.domain.simple.PointsRuleSimple;
import com.nbsaas.boot.marketing.rest.convert.PointsRuleSimpleConvert;
import com.nbsaas.boot.marketing.rest.convert.PointsRuleEntityConvert;
import com.nbsaas.boot.marketing.rest.convert.PointsRuleResponseConvert;
import com.nbsaas.boot.marketing.data.repository.PointsRuleRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   积分规则-业务接口实现
*/
@Transactional
@Service
public class PointsRuleResource extends BaseResource<PointsRule,PointsRuleResponse, PointsRuleSimple, PointsRuleRequest>  implements PointsRuleApi {

    @Resource
    private PointsRuleRepository pointsRuleRepository;

    @Override
    public JpaRepositoryImplementation<PointsRule, Serializable> getJpaRepository() {
        return pointsRuleRepository;
    }

    @Override
    public Function<PointsRule, PointsRuleSimple> getConvertSimple() {
        return new PointsRuleSimpleConvert();
    }

    @Override
    public Function<PointsRuleRequest, PointsRule> getConvertForm() {
        return new PointsRuleEntityConvert();
    }

    @Override
    public Function<PointsRule, PointsRuleResponse> getConvertResponse() {
        return new PointsRuleResponseConvert();
    }




}


